<script setup>
import {useRouter} from 'vue-router'

const router = useRouter()

function login() {
  //router.push('/login')

  //router.push({name: 'login'})
  router.push({name: 'user', params: {id: 88, name: '张三丰'}})
}
</script>

<template>

  <header>
    <button @click="router.back()">&lt;-back</button><button @click="router.forward()">next-&gt;</button>
    <router-link to="/">项目首页</router-link>&nbsp;
    <router-link to="/stu">学生中心</router-link>&nbsp;

    <router-link to="/user/李四/100">李四</router-link>&nbsp;
    <router-link to="/user/王五/99">王五</router-link>&nbsp;

    <button @click="login">登录</button>
  </header>
  <router-view/>
</template>

<style scoped>
a[class] {
  text-decoration: none;
  color: orange;
}

.router-link-active {
  color: red !important;
}
</style>
